//
//  config.h
//  DrinkingPlan
//
//  Created by 张德广 on 2019/3/15.
//  Copyright © 2019 Drinking Plan. All rights reserved.
//

#ifndef config_h
#define config_h


#define random(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0]
#define randomColor random(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))
#define COLOR_RGB(_R, _G, _B, _A) [UIColor colorWithRed:_R / 255.0 green:_G / 255.0 blue:_B / 255.0 alpha:_A]
#define UIColorOfHex(s) [UIColor colorWithRed:(((s & 0xFF0000) >> 16))/255.0 green:(((s & 0xFF00) >> 8))/255.0 blue:((s & 0xFF))/255.0  alpha:1]
#define UIColorOfHexA(s, _A) [UIColor colorWithRed:(((s & 0xFF0000) >> 16))/255.0 green:(((s & 0xFF00) >> 8))/255.0 blue:((s & 0xFF))/255.0  alpha:_A]
#define ThemeColor  COLOR_RGB(255, 255, 255, 1.0)
#define TextColor   UIColorOfHex(0x333333)


#define TextFont(_A)   [UIFont fontWithName:@"KohinoorDevanagari-Medium" size:_A]
#define NumberFont(_A)   [UIFont fontWithName:@"CHERRYDINPro-Medium" size:_A]


#define ScreenWidth   [[UIScreen mainScreen] bounds].size.width
#define ScreenHeight  [[UIScreen mainScreen] bounds].size.height
#define SCAlE_WIDTH   [UIScreen mainScreen].bounds.size.width/320.0
#define SCAlE_HEIGHT  [UIScreen mainScreen].bounds.size.height/568.0

#define isiPad [[UIDevice currentDevice].model rangeOfString:@"iPad"].length != 0 ? YES:NO


// 判断iOS11版本
#define IOS_VERSION_11 @available(iOS 11.0, *)
// 判断iPhoneX、iPhoneXR、iPhoneXSMAX
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhoneXSMAX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)


// Status bar height.
#define StatusBarHeight      (iPhoneX ? 44.f : 20.f)
// Navigation bar height.
#define NavigationBarHeight  44.f
// Tabbar height.
#define TabbarHeight         (iPhoneX ? (49.f+34.f) : 49.f)
// Tabbar safe bottom margin.
#define TabbarSafeBottomMargin         (iPhoneX ? 34.f : 0.f)
// Status bar & navigation bar height.
#define SafeAreaTopHeight (ScreenHeight == 812.0 ? 88 : 64)
// safeAreaInsets
#define ViewSafeAreaInsets(view) ({UIEdgeInsets insets; if(@available(iOS 11.0, *)) {insets = view.safeAreaInsets;} else {insets = UIEdgeInsetsZero;} insets;})


#endif /* config_h */
